package com.fruitshop.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 购买记录
 * @TableName buy_record
 */
public class BuyRecord implements Serializable {
    /**
     * 主键
     */
    private Integer id;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 水果id
     */
    private Integer fruitId;

    /**
     * 购买数量
     */
    private Integer amount;

    /**
     * 总价
     */
    private BigDecimal price;

    /**
     * 购买时间
     */
    private LocalDateTime buyTime;

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    public Integer getId() {
        return id;
    }

    /**
     * 主键
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 用户ID
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * 用户ID
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    /**
     * 水果id
     */
    public Integer getFruitId() {
        return fruitId;
    }

    /**
     * 水果id
     */
    public void setFruitId(Integer fruitId) {
        this.fruitId = fruitId;
    }

    /**
     * 购买数量
     */
    public Integer getAmount() {
        return amount;
    }

    /**
     * 购买数量
     */
    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    /**
     * 总价
     */
    public BigDecimal getPrice() {
        return price;
    }

    /**
     * 总价
     */
    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    /**
     * 购买时间
     */
    public LocalDateTime getBuyTime() {
        return buyTime;
    }

    /**
     * 购买时间
     */
    public void setBuyTime(LocalDateTime buyTime) {
        this.buyTime = buyTime;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BuyRecord other = (BuyRecord) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getFruitId() == null ? other.getFruitId() == null : this.getFruitId().equals(other.getFruitId()))
            && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getBuyTime() == null ? other.getBuyTime() == null : this.getBuyTime().equals(other.getBuyTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getFruitId() == null) ? 0 : getFruitId().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getBuyTime() == null) ? 0 : getBuyTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", fruitId=").append(fruitId);
        sb.append(", amount=").append(amount);
        sb.append(", price=").append(price);
        sb.append(", buyTime=").append(buyTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}